package com.osmino.contacts.list;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.osmino.contacts.R;
import com.osmino.contacts.entity.Phone;
import com.osmino.core.utils.view.Backgroung;

public final class ContactViewPhoneItem extends ContactViewBaseItem {

	public ContactViewPhoneItem(Context context, IContactViewController controller) {
		super(context, controller);
	}

	private Phone mPhone;
	
	public void setPhone(Phone phone) {
		mPhone = phone;
		setText1(mPhone.number);
		setText2(mPhone.label);
	}

	@Override
	public void onClick(View view) {
		int viewId = view.getId();
		switch (viewId) {
			case R.id.contact_view_iv1:
				mController.onCallButtonClick(mPhone);
				break;
			case R.id.contact_view_iv2:
				mController.onSmsButtonClick(mPhone);
				break;
		}
	}

	@Override
	public void setImagesTo(ImageView iv1, ImageView iv2) {
		Backgroung.setResource(iv1, R.drawable.contact_view_call_ic,
				R.drawable.contact_view_call_ic_active);
		Backgroung.setResource(iv2, R.drawable.contact_view_sms_ic,
				R.drawable.contact_view_sms_ic_active);
	}

}
